package com.javaexplorer.redis.init;

import org.redisson.Redisson;
import org.redisson.api.RAtomicLong;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@Order(0)
public class StartupApplicationRunner implements ApplicationRunner {

    @Resource
    Redisson redisson;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        RAtomicLong rAtomicLong = redisson.getAtomicLong("total");
        rAtomicLong.set(1000);
    }
}
